The present invention relates to building programs or scripts that transform (e.g., convert, translate) any structured text including text of programs in computer languages such as Cobol, C, or C++, and electronic documents such as SGML, HTML or word processor documents. More specifically, the invention relates to building the transformation programs or scripts interactively using a graphical user interface (GUI) of a programmed. computer system.
A number of computer applications that transform (e.g., convert, translate) structured text use trees as internal representations of this structured text. For instance, most computer language compilers use trees to represent the compiled program structure in compiler memory.
Another example of structured text is electronically published structured documents such as SGML documents described in U.S. Pat. No. 5,708,806, or World Wide Web structured documents marked up using HTML mark-up language.
However, these prior art systems are either not concerned about transforming the tree or all tree transformations in these prior art systems are programmed using traditional programming languages such a C, C++, Java, Lisp, or Perl.
Programming tree transformations using traditional programming languages lacks visual feedback. That is, when writing a tree transformation program in a traditional programming language, a user needs to navigate complex tree structures without seeing them. Accordingly, the users often must use paper and pen to visualize tree transformations which they perform in their programs. This makes writing tree-transforming programs a labor-intensive and error-prone process that can be performed only by a small number of highly skilled programmers, and is therefore expensive.
On the other hand, graphical representations of trees in graphical user interfaces are currently widely available in most computer systems, and have become a de-facto standard for representing certain hierarchies of objects found in computer systems, such as a file system directory hierarchy or networked computer resources hierarchy.
For example, Microsoft Corporation(copyright) provides tree control that implements interactive tree browsing and manipulation capability as a default part of the operating systems Windows 95(copyright) and Windows NT(copyright), as in U.S. Pat. No. 5,701,137. Additionally, Microsoft Corporation(copyright) provides a product named xe2x80x9cWindows Explorerxe2x80x9d that uses this tree control to represent files and networked computer resources as a tree.
However, in the prior art, graphical tree transformation operations, such as Cut, Copy, Delete, and Paste, are not applied to the tree nodes representing the structured text to cause a Hi change in the structured text. Further, in the prior art it is not possible to visually construct even simple programs or scripts that systematically transform such trees and corresponding structured text.
In xe2x80x9cMicrosoft Wordxe2x80x9d application Microsoft Corporation provides a tree view of Word document using xe2x80x9cDocument Mapxe2x80x9d feature. The Document Map is a coarse-grain tree that represents Word document which is a kind of structured text. However, in Microsoft Word it is not possible to cause a change in the Word document by applying graphical tree commands such as Cut, Paste, Delete to this document""s Document Map. Nor is it possible to record a sequence of visual tree operations that cause a change in the document.
U.S. Pat. No. 5,715,432 discloses building GUI applications for network analysis and modeling. However, it does not relate to programming systematic transformations of the structured text and its tree.
U.S. Pat. No. 5,557,730 discloses a mechanism for graphical browsing of symbol table information of the compiled program. However, it covers only browsing of the tree and not its modification. The subject of the present invention is programming systematic changes of the tree.
U.S. Pat. No. 5,642,511 teaches a method that improves visual building of the GUI programs. The method of this patent deals with hierarchy of GUI objects and this hierarchy is represented by a tree. However, in this patent every tree transformation is performed in response to an explicit user command, and visual programming of systematic tree transformations is not even mentioned.
U.S. Pat. No. 5,696,914 likewise is concerned with the improving of GUI application building, and not with building programs that transform structured text.
U.S. Pat. No. 5,671,416 teaches a method for searching and transforming structured text, or source code. However, this patent discloses how to compose transformation programs using traditional programming languages, not in a visual manner.
U.S. Pat. No. 5,537,630 teaches visually programming GUI interfaces, and it does not relate to visual construction of tree-transforming programs.
From the foregoing, it is seen that it is a problem in the art to provide a data processing system and method which allows a user to cause the change of the structured text by manipulating visual tree representation of this text using graphical commands such as Copy, Paste, Delete and to interactively build programs or scripts that transform structured text using a graphical user interface of a computer system. According to the present invention, a data processing system and method is provided which meets the aforementioned needs in the prior art.
Specifically, the data processing system and method according to the present invention can be used to program applications that systematically convert text of computer programs.
For example, the computer programming language Cobol has more than 1 dialects. When a program is moved to a different hardware platform or a different compiler, the program may need to be systematically changed to account for differences between Cobol dialect on the old platform and the new platform. According to the present invention, Cobol program converters can be programmed interactively in a fraction of time needed to program these converters using a traditional programming language.
Additionally, the data processing system and method according to the present invention can be used in powerful program text editors. Traditional program text editors can only modify text of the computer program, but usually they cannot perform operations that require knowledge of the structure of the edited program.
Some program text editors such as Emacs are aware of the edited program structure and they would let a user to perform certain operations that cause the tree of the edited text to be transformed. However, these tree-transforming operations are programmed in a traditional programming language such as Lisp or C++, and these editors do not give user a capability to visually program text transformations by means of the underlying tree transformations. Using this invention, such a capability can be added to the program text editors.
Further, the data processing system and method according to the present invention can be used to transform HTML or SGML documents in order to extract information essential to the user of the document and to leave out non-essential elements of HTML (SGML) document such as excessive graphics or commercial messages unrelated to the essential content of the document.
Addressing the drawbacks of conventional programming of tree transforming programs or scripts where the user is required to write transformation script in a traditional computer language, this invention provides a visual and interactive method for writing such tree transforming programs or scripts. The method according to the present invention is typically implemented in an application that has a graphical user interface and runs in a windowing environment.
Specifically, in a first window (for example in a left pane of an application window), the application displays a tree that represents the structured text. In the second window (for example in a right pane of an application window), the application displays the structured text itself. The user can apply tree transforming operations to the tree nodes using familiar visual commands, such as Cut, Paste, and Delete. The effect of these operations on the corresponding structured text is immediately reflected in the text window.
Tree displayed in the first window is always synchronized with the structured text displayed in the second window: if tree node is selected by user in the first window, the corresponding fragment of structured text is highlighted in the second window; if text fragment is selected or clicked by the user in the second window, the corresponding tree node is highlighted in the first window. When tree nodes are deleted, copied or moved using the graphical tree manipulation commands, the corresponding changes are immediately reflected in the structured text window.
The set of available graphical tree operations consists of: (a) elementary system-defined operations, and (b) macro programs or user-defined operations. A sequence of individual visual operations on tree nodes can be recorded as a macro program and executed as a new single user-defined operation. Recorded macro programs can be executed on a single sub-tree specified by the user, or they can be automatically executed on all sub-trees that satisfy a user-specified search criterion.
In addition, the recorded macro program can be automatically converted to program in a traditional programming language, such as C++. This creates a capability to use visually programmed tree transformation programs in the traditional non-visual programs.